package cn.walls1717.wallsmall.member.web;

import cn.walls1717.wallsmall.common.utils.R;
import cn.walls1717.wallsmall.member.feign.OrderFeignService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * 支付成功
 *
 * @author walls1717
 * @since 2022/11/24 11:38
 **/
@Controller
@Slf4j
public class MemberWebController {
    @Resource
    private OrderFeignService orderFeignService;

    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum", defaultValue = "1") String pageNum, Model model) {

        HashMap<String, Object> params = new HashMap<>();
        params.put("page", pageNum);
        R r = orderFeignService.listWithItem(params);
        model.addAttribute("orders", r);
        log.info("r -> {}", JSON.toJSONString(r));
        return "orderList";
    }
}
